﻿using System;
using XSTDZ.ERP.Application.DataContracts;
using System.Collections.Generic;

namespace XSTDZ.ERP.Application
{
    /// <summary>
    /// 销售退货服务
    /// </summary>
    public interface IProductReturnBillService
    {
        #region 销售退货订单
        /// <summary>
        /// 添加销售退货任务单据
        /// </summary>
        /// <param name="productReturnBillDto"></param>
        Guid AddProductReturnBill(ProductReturnBillDto productReturnBillDto);
        /// <summary>
        /// 添加销售退货任务单据
        /// </summary>
        /// <param name="productReturnBillDto"></param>
        Guid AddProductReturnBill(ProductReturnBillDto productReturnBillDto, IEnumerable<ProductReturnBillDetailDto> productReturnBillDetailDto);
        /// <summary>
        /// 添加销售退货任务单据
        /// </summary>
        /// <param name="productReturnBillDto"></param>
        Guid AddProductReturnBill(Guid productReturnBillId, IEnumerable<ProductReturnBillDetailDto> productReturnBillDetailDto);
        void UpdateProductReturnBill(ProductReturnBillDto productReturnBillDto);
        void UpdateProductReturnBill(Guid productReturnBillId, IEnumerable<ProductReturnBillDetailDto> productReturnBillDetailDto);
        void UpdateProductReturnBill(ProductReturnBillDto productReturnBillDto, IEnumerable<ProductReturnBillDetailDto> productReturnBillDetailDto);

        void ConvertProductReturnBillDeleteState(Guid productReturnBillId);
        void ConvertProductReturnBillDeleteState(Guid productReturnBillId, IEnumerable<Guid> productReturnDetailIds);

        ProductReturnBillDto GetProductReturnBill(Guid productReturnBillId);
        IEnumerable<ProductReturnBillDto> GetProductReturnBills(int pageIndex, int pageSize);
        //把生成的盘点单数据更新至库存，会影响库存
        void UpdateToStock(Guid profitAndLossBillId, IEnumerable<Guid> profitAndLossBillDetailIds);
       
        #endregion
        #region 销售退货订单明细
        void AddProductReturnBillDetail(Guid productInBillId, ProductReturnBillDetailDto productCheckBillDetailDto);
        void UpdateProductReturnBillDetail(Guid productInBillId, IEnumerable<ProductReturnBillDetailDto> productReturnBillDetailDto);
        ProductReturnBillDetailDto GetProductReturnBillDetail(Guid productCheckBillDetailId);
        IEnumerable<ProductReturnBillDetailDto> GetProductReturnBillDetails(Guid productReturnBillId);

        #endregion
        #region 其它
        /// <summary>
        /// 获得当前销售退货单单号的最大单号
        /// </summary>
        /// <returns></returns>
        string GetMaxBillNo();
        #endregion
        #region 审核
        /// <summary>
        /// 审核(并生成相应的收款单）
        /// </summary>
        /// <param name="outBillIds">符合条件的ID</param>
        /// <param name="auditId">审核人ID</param>
        void Audit(IList<Guid> billIds,Guid auditId,Guid orgId);
        //审核(已过时，建议不要用，不会生成相应付款单)
        void Audit(Guid profitAndLossBillId, Guid UserID);
        /// <summary>
        /// 提交
        /// </summary>
        /// <param name="profitAndLossBillId"></param>
        /// <param name="UserID"></param>
        void Confirm(Guid profitAndLossBillId);
        #endregion
        #region 获得主数据、明细行数据
        Dictionary<ProductReturnBillDto, IEnumerable<ProductReturnBillDetailDto>> GetBillAndDetails(Guid outBillId);
        #endregion
    }
}
